# 使用官方 Python 基础镜像
FROM python:3.9-slim

# 设置工作目录
WORKDIR /app

# 将应用文件复制到容器中
COPY app.py requirements.txt start.sh mysqldump.cnf /app/
# 安装 Python 依赖
RUN sed -i 's/deb.debian.org/mirrors.huaweicloud.com/g' /etc/apt/sources.list.d/debian.sources && \
    apt update && \
    apt install -y mariadb-client && \
    pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ && \ 
    apt clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
    chmod +x start.sh
# COPY mysqldump.cnf /etc/mysql/conf.d/mysqldump.cnf 
ENV TZ=Asia/Shanghai
# 暴露 Web 应用的端口
EXPOSE 5999
# 启动 Flask 应用
# ENTRYPOINT ["./start.sh"]
CMD ["./start.sh"]
